var n = require("../../../uv-ui-tools/libs/mixin/mpMixin.js"), i = require("../../../uv-ui-tools/libs/mixin/mixin.js"), e = require("./props.js"), t = require("../../../../common/vendor.js");

require("../../../uv-ui-tools/libs/function/index.js"), require("../../../uv-ui-tools/libs/function/test.js"), 
require("../../../uv-ui-tools/libs/function/digit.js"), require("../../../uv-ui-tools/libs/util/route.js"), 
require("../../../uv-ui-tools/libs/function/debounce.js"), require("../../../uv-ui-tools/libs/function/throttle.js");

var o = {
    name: "uv-input",
    mixins: [ n.mpMixin, i.mixin, e.props ],
    data: function() {
        return {
            innerValue: "",
            focused: !1,
            innerFormatter: function(n) {
                return n;
            }
        };
    },
    created: function() {
        this.innerValue = this.modelValue;
    },
    watch: {
        value: function(n) {
            this.innerValue = n;
        },
        modelValue: function(n) {
            this.innerValue = n;
        }
    },
    computed: {
        isShowClear: function() {
            var n = this.clearable, i = this.readonly, e = this.focused, t = this.innerValue;
            return !!n && !i && !!e && "" !== t;
        },
        inputClass: function() {
            var n = [], i = this.border, e = (this.disabled, this.shape);
            return "surround" === i && (n = n.concat([ "uv-border", "uv-input--radius" ])), 
            n.push("uv-input--".concat(e)), "bottom" === i && (n = n.concat([ "uv-border-bottom", "uv-input--no-radius" ])), 
            n.join(" ");
        },
        wrapperStyle: function() {
            var n = {};
            return this.disabled && (n.backgroundColor = this.disabledColor), "none" === this.border ? n.padding = "0" : (n.paddingTop = "6px", 
            n.paddingBottom = "6px", n.paddingLeft = "9px", n.paddingRight = "9px"), this.$uv.deepMerge(n, this.$uv.addStyle(this.customStyle));
        },
        inputStyle: function() {
            var n = {
                color: this.color,
                fontSize: this.$uv.addUnit(this.fontSize),
                textAlign: this.inputAlign
            };
            return (this.disabled || this.readonly) && (n["pointer-events"] = "none"), n;
        }
    },
    methods: {
        setFormatter: function(n) {
            this.innerFormatter = n;
        },
        onInput: function(n) {
            var i = this, e = (n.detail || {}).value, t = void 0 === e ? "" : e, o = (this.formatter || this.innerFormatter)(t);
            this.innerValue = t, this.$nextTick(function() {
                i.innerValue = o, i.valueChange();
            });
        },
        onBlur: function(n) {
            var i = this;
            this.$emit("blur", n.detail.value), this.$uv.sleep(100).then(function() {
                i.focused = !1;
            }), this.$uv.formValidate(this, "blur");
        },
        onFocus: function(n) {
            this.focused = !0, this.$emit("focus");
        },
        onConfirm: function(n) {
            this.$emit("confirm", this.innerValue);
        },
        onkeyboardheightchange: function(n) {
            this.$emit("keyboardheightchange", n);
        },
        valueChange: function() {
            var n = this;
            this.isClear && (this.innerValue = "");
            var i = this.innerValue;
            this.$nextTick(function() {
                n.$emit("input", i), n.$emit("update:modelValue", i), n.$emit("change", i), n.$uv.formValidate(n, "change");
            });
        },
        onClear: function() {
            var n = this;
            this.innerValue = "", this.isClear = !0, this.$uv.sleep(200).then(function(i) {
                n.isClear = !1;
            }), this.$nextTick(function() {
                n.$emit("clear"), n.valueChange();
            });
        },
        clickHandler: function() {}
    }
};

Array || t.resolveComponent("uv-icon")(), Math;

var r = t._export_sfc(o, [ [ "render", function(n, i, e, o, r, u) {
    return t.e({
        a: n.prefixIcon
    }, n.prefixIcon ? {
        b: t.p({
            name: n.prefixIcon,
            size: "18",
            customStyle: n.prefixIconStyle
        })
    } : {}, {
        c: t.s(u.inputStyle),
        d: n.type,
        e: n.focus,
        f: n.cursor,
        g: r.innerValue,
        h: n.autoBlur,
        i: n.disabled || n.readonly,
        j: n.maxlength,
        k: n.placeholder,
        l: n.placeholderStyle,
        m: n.placeholderClass,
        n: n.confirmType,
        o: n.confirmHold,
        p: n.holdKeyboard,
        q: n.cursorSpacing,
        r: n.adjustPosition,
        s: n.selectionEnd,
        t: n.selectionStart,
        v: n.password || "password" === n.type || void 0,
        w: n.ignoreCompositionEvent,
        x: t.o(function() {
            return u.onInput && u.onInput.apply(u, arguments);
        }),
        y: t.o(function() {
            return u.onBlur && u.onBlur.apply(u, arguments);
        }),
        z: t.o(function() {
            return u.onFocus && u.onFocus.apply(u, arguments);
        }),
        A: t.o(function() {
            return u.onConfirm && u.onConfirm.apply(u, arguments);
        }),
        B: t.o(function() {
            return u.onkeyboardheightchange && u.onkeyboardheightchange.apply(u, arguments);
        }),
        C: t.o(function() {
            return u.clickHandler && u.clickHandler.apply(u, arguments);
        }),
        D: u.isShowClear
    }, u.isShowClear ? {
        E: t.p({
            name: "close",
            size: "11",
            color: "#ffffff",
            customStyle: "line-height: 12px"
        }),
        F: t.o(function() {
            return u.onClear && u.onClear.apply(u, arguments);
        })
    } : {}, {
        G: n.suffixIcon
    }, n.suffixIcon ? {
        H: t.p({
            name: n.suffixIcon,
            size: "18",
            customStyle: n.suffixIconStyle
        })
    } : {}, {
        I: t.n(u.inputClass),
        J: t.s(u.wrapperStyle)
    });
} ], [ "__scopeId", "data-v-7b2b9846" ] ]);

wx.createComponent(r);